<!doctype html>
<html lang="en">
<head>
 @include('web.layout.head')
<link rel="stylesheet" href="{{mix('/css/web/shop/shop_header.css')}}">
<link rel="stylesheet" href="{{mix('/css/web/shop/shop.css')}}">
<title>店铺首页</title>

</head>
<body class="por shop_1">
<div class="mask"></div>
<div class="prompt_box">
    <div class="closebox">
        <img src="{{asset('/img/web/deal/cancle.png')}}" alt="" width="16" height="14">
    </div>
    <div class="prompt_title">联系方式</div>
    <div class="prompt_content">
        <p>商家：<span>111</span></p>
        <p>联系电话：155988888</p>
        <p>您也可以使联系安防管家查找卖家，免费拨打400-016-6889</p>
    </div>
</div>
<div class="headerbox">
    @include('web.layout.product_head')
    @include('web.shop.top_nav')
    {{--<div class="company_option shop_bg{{$shop['sp_templete']}}">--}}
        {{--<div class="w1200">--}}
            {{--<ul>--}}
                {{--<a href="/shop/index/{{$shop['sp_id']}}"><li data-type="supply_index" >首页</li></a>--}}
                {{--<a href="/shop/products/{{$shop['sp_id']}}"><li data-type="supply_glists">供应产品</li></a>--}}
                {{--<a href="/shop/archives/{{$shop['company']['id']}}"><li data-type="archives" >公司档案</li></a>--}}
                {{--<a href="/shop/attribute/{{$shop['sp_id']}}"><li data-type="attribute"  class="active">资质服务</li></a>--}}

            {{--</ul>--}}
            {{--@if(array_get($check,'checkShop')&&session('user_id')!=null)--}}
                {{--<div class="on_collection">已收藏店铺</div>--}}
            {{--@else--}}
                {{--<div class="on_collection collection_shop">收藏店铺</div>--}}
            {{--@endif--}}
        {{--</div>--}}
    {{--</div>--}}
</div>
<div class="company_tab_box">
    <div class="swiper-container banner">
        <div class="swiper-wrapper">
            @if(!empty($shop['shop_banners']))
                @foreach(array_get($shop,'shop_banners') as $key=>$value)
                    <div class="swiper-slide"><img src="{{$value['banner_image']}}" alt="{{$value['banner_name']}}"></div>
                @endforeach
            @else
                <div class="swiper-slide"><img src="{{asset('/img/web/deal/banner/banner'.$shop['sp_templete'].'.jpg')}}" alt=""></div>
            @endif
        </div>
        <div class="swiper-pagination"></div>
    </div>
{{--    <div class="banner"><img src="{{asset('/img/web/deal/banner/banner'.$shop['sp_templete'].'.jpg')}}" alt=""></div>--}}
    <div class="company_tab" id="supply_index" style="display: block;">
        <div class="company_bigbox">
            <div class="w1200">
                <div class="bigbox_left">
                    <div class="infobox">
                        <div class="titlebox shop_bg{{$shop['sp_templete']}}">
                            <div class="tit">{{$shop['company']['company_name']}}</div>
                        </div>
                        <div class="title_bot">
                            <div class="bot_top">
                                <div class="top_left fl">联系人：</div>
                                <div class="top_right fl"><span>{{$shop['company']['angent']}}</span></div>
                            </div>
                            <div class="bot_top">
                                <div class="top_left fl">经营模式：</div>
                                <div class="top_right fl"><span>生产厂家</span></div>
                            </div>
                            <div class="bot_top">
                                <div class="top_left fl">店铺等级：</div>
                                <div class="top_right fl"><span>{{$shop['shop_level']['lv_txt_tag']}}</span></div>
                            </div>
                            <div class="bot_top">
                                <div class="top_left fl">店铺标识：</div>
                                <div class="top_right fl">
                                    @for($i=0;$i<$shop['shop_level']['lv_ico_tag'];$i++)
                                    <img src="{{asset('/img/web/inc/icon/star2.png')}}"alt="">
                                        @endfor
                                </div>
                            </div>
                            <div class="bot_top" style="height: auto;display: inline-block;">
                                <div class="top_left fl">联系商家：</div>
                                <div class="top_right fl" style="width: 128px;">
                                    <span>
                                        <a href="javascript:void(0);" id="contact" data-id="{{session('user_id')}}">
                                            点击联系<img src="{{asset('img/contactus.gif')}}">
                                        </a>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="typebox">
                        <div class="titlebox shop_bg{{$shop['sp_templete']}}"><div class="tit">产品分类</div></div>
                        <div class="title_bot">
                            <ul>
                                @if(!empty($categories))
                                    @foreach($categories as $k=>$v)
                                        <li>
                                            <div class="border_l_b border_l_b_1"></div>
                                            <div class="type fl"><a href="{{url('/shop/products').'/'.$shop['sp_id']}}?custom_cate={{$v['id']}}" title="{{$v['name']}}">{{$v['name']}}</a></div>
                                        </li>
                                    @endforeach
                                @endif

                            </ul>
                        </div>
                    </div>
                    <div class="cetifivatebox">
                        <div class="titlebox shop_bg{{$shop['sp_templete']}}"><div class="tit">企业证书</div></div>
                        <div class="title_bot">
                            <ul>
                                @if($shop['company']['agnet_licence'])
                                <li>
                                    <div class="imgbox">
                                        <img src="{{$shop['company']['agnet_licence']}}" alt="" />
                                    </div>
                                    <a>点击查看</a>
                                </li>
                                @endif
                                @if($shop['company']['tax_certificate'])

                                <li>
                                    <div class="imgbox">
                                        <img src="{{$shop['company']['tax_certificate']}}" alt=""/>
                                    </div>
                                    <a>点击查看</a>
                                </li>
                                    @endif
                                    @if($shop['company']['organization_code_certificate'])

                                <li>
                                    <div class="imgbox">
                                        <img src="{{$shop['company']['organization_code_certificate']}}" alt="" />
                                    </div>
                                    <a>点击查看</a>
                                </li>
                                @endif
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="bigbox_right">
 <!--                   <div class="h2_top_tit">
                        <span>首页＞服务＞资质服务</span>
                    </div>-->
                    <div class="service_list">
                        <table>
                            <thead>
                            <tr>
                                <th>
                                    <label class="checkbox-inline"><input type="checkbox" class="checkboxall" name="" value="1"/><font>全选</font></label>
                                </th>
                                <th>资质名称</th>
                                <th width="150">级别</th>
                                <th width="150">费用</th>
                                <th width="150">成交量</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if(!empty($product['list']))
                                @foreach($product['list'] as $k=>$v)
                                <tr>
                                    <td>
                                        <label class="checkbox-inline"><input type="checkbox" class="checkbox" name="menu[]" value="{{$v['attrs']['id']}}"/></label>
                                    </td>
                                    <td>
                                        <img width="150" src="{{$v['cover_image']}}">
                                        <p>{{$v['name']}}</p>
                                    </td>
                                    <td>{{$v['attrs']['level']}}</td>
                                    <td>
                                        {{--@if(isset($v['attrs']['text']))--}}
                                            {{--@foreach($v['attrs']['text'] as $key=>$val)--}}
                                                {{--<span>{{$val}}</span>--}}
                                            {{--@endforeach--}}
                                        {{--@endif--}}
                                        @if(isset($v['attrs']))
                                            <span>{{$v['attrs']['price']}}</span>
                                       @endif
                                    </td>
                                    <td>{{$v['succ_num']}}单</td>
                                </tr>
                                @endforeach
                            @endif

                            </tbody>
                        </table>
                        <div class="buy_btn fr" data-shopid="1">立即购买</div>
                    </div>
                    <div class="page">
                       @include('web.common.paginate', ['page' => $product['page']])
                   </div>
                </div>

            </div>
        </div>
    </div>
</div>
 @include('web.layout.footer_ware1')
</body>
</html>
<script>
    window.onload=function(){
        divWidth();
    }
    //当浏览器窗口大小改变时，设置显示内容的高度
    window.onresize=function(){
        divWidth();
    }
    function divWidth(){
        var w = document.documentElement.clientWidth;//获取页面可见高度
        $('.banner').css({'height':w*(420/1920),'overflow':'hidden'});
    }

    $(function () {

        var jud = '{{ Session::get("user_id")}}';
        var shopId = '{{ Session::get("user_shop_id")}}';

        var mySwiper = new Swiper('.swiper-container', {
          autoplay: {
            delay: 3000,//1秒切换一次
          },
          pagination :{
            el: '.swiper-pagination',
            clickable :true,
          }
        });
        //input获得失去焦点效果
        $('input[type="text"]').focus(function () {
            $(this).addClass("active");
        })
        $('input[type="text"]').blur(function () {
            $(this).removeClass("active");
        })
        $('.searchbox li').click(function () {
            $(this).addClass('active').siblings().removeClass('active');
        })

        //联系方式弹框
        $('.intobox').click(function () {
            $('.mask').show();
            $('.prompt_box').show();
        })
        $('.prompt_box .closebox').click(function () {
            $('.prompt_box').hide();
            $('.mask').hide();
        })

        //企业证书放大效果
        layer.photos({
            photos: '.cetifivatebox'
            // ,area: '840px'
            ,anim: 0 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
        });


        $('.category .more').click(function () {
            $(this).hide();
            $('.category').css('height','auto');
        });
        $('.brand .more').click(function () {
            $(this).hide();
            $('.brand').css('height','auto');
        });

        //服务
        //全选
        $('.checkboxall').on('click', function(event){
            var _this = this;
            if($(_this).is(':checked')){
                $(".service_list tbody input[type = 'checkbox']").each(function(){
                    $(this).prop("checked","checked");
                })
            }else{
                $(".service_list tbody input[type = 'checkbox']").each(function(){
                    $(this).prop("checked","");
                })
            }
        })
        //单选
        $(".service_list tbody input[type = 'checkbox']").on('click', function(event){
            if($(".service_list tbody input[type = 'checkbox']").length == $(".service_list tbody input[type = 'checkbox']:checked").length){
                $('.checkboxall').prop("checked","checked");
            }else{
                $('.checkboxall').prop("checked","");
            }
        })
        var ids = [];
        //立即购买
        $(".buy_btn").on('click', function(event){
            if(jud) {
                if(shopId){
                    if ($(".service_list tbody input[type = 'checkbox']:checked").length > 0) {

                        $(".service_list tbody input[type = 'checkbox']:checked").each(function () {
                            ids.push($(this).val());
                        });
                        var shop_id = '{{$shop['sp_id']}}';

                        $.ajax({
                            url: "/member/buyer/attribute/add_arris",
                            type: "get",
                            data: {ids: ids,shop_id:shop_id},
                            dataType: 'json',
                            success: function (data) {
                                if (0 == data.code) {
                                    location.href = '/member/buyer/attribute/create';
                                } else {
                                    layer.alert(data.message, {icon: 0});
                                }
                            }
                        });
                    } else {
                        layer.alert('请选择购买的资质', {
                            title: '提示',
                            icon: 0
                        });
                    }
                }else{
                    layer.alert('未通过企业认证用户不能购买', {
                        title: '提示',
                        icon: 0
                    });
                }

            } else {
                layer.alert('请登录后购买', {
                    title: '提示',
                    icon: 0
                },function(){
                    location.href = '/user/login';
                });
            }
        });
    });


</script>